<?
if(!ANTIHACK) die("ANTIHACK...");
if($_GET['act']=='post') 
	{
		$filename="page.php";
		$q=query("select * from other where code='title'");
		$r=fetch($q);
		DEFINE("SITE_NAME",$r["content2"],true);
		DEFINE("SITE_KEYWORDS",$r["content4"],true);
		$q=query("select title,described,tags,image from post where id=$_GET[id]");
		$r=fetch($q);
		DEFINE("SITE_TITLE",str_replace("'",'"',$r["title"]." - ".SITE_NAME),true);
		DEFINE("SITE_DESCRIPTION",str_replace("'",'"',$r["described"]),true);
		DEFINE("SITE_KEYWORDS",str_replace("'",'"',SITE_KEYWORDS.", ".$r["tags"]),true);
		DEFINE("SITE_IMAGE",$r["image"],true);
	}
elseif($_GET['act']=='ngoisaotocviet') 
	{
		$filename="ngoisaotocviet.php";
		$q=query("select * from other where code='title'");
		$r=fetch($q);
		DEFINE("SITE_NAME",$r["content2"],true);
		DEFINE("SITE_KEYWORDS",$r["content4"],true);
		DEFINE("SITE_TITLE","Danh Sách ngôi sao ngành tóc việt - ngoisaotocviet.vn",true);
		DEFINE("SITE_DESCRIPTION","Những Ngôi sao trong làng tóc Việt.",true);
		//DEFINE("SITE_KEYWORDS",str_replace("'",'"',SITE_KEYWORDS.", ".$r["tags"]),true);
		DEFINE("SITE_IMAGE","",true);
	}
elseif($_GET['act']=='tags') 
	{
		$filename="tags.php";
		$q=query("select * from other where code='title'");
		$r=fetch($q);
		DEFINE("SITE_NAME",str_replace("'",'"',$r["content2"]),true);
		DEFINE("SITE_DESCRIPTION",str_replace("'",'"',$r["content3"]),true);
		DEFINE("SITE_KEYWORDS",str_replace("'",'"',$r["content4"].", $_GET[code]"),true);
		DEFINE("SITE_TITLE",str_replace("'",'"',"Tags: $_GET[code] - ".SITE_NAME),true);
		DEFINE("SITE_IMAGE","",true);
	}
elseif($_GET['act']=='menu')
{
		$q=query("select * from other where code='title'");
		$r=fetch($q);
		DEFINE("SITE_NAME",str_replace("'",'"',$r["content2"]),true);
		DEFINE("SITE_KEYWORDS",str_replace("'",'"',$r["content4"]),true);
		
		if($_GET['code']=='oscar-for-hair')
		{
			DEFINE("SITE_DESCRIPTION",'Chương trình Oscer For Hair 2014 do trang thông tin điện tử www.tocvasao.net tổ chức. Tôn vinh ngôi sao ngành tóc viêt.',true);
			DEFINE("SITE_IMAGE","http://tocvasao.net/images/logo-oscar.jpg",true);
		}
		else{
			DEFINE("SITE_DESCRIPTION",str_replace("'",'"',$r["content3"]),true);
			DEFINE("SITE_IMAGE","",true);
		}
		$q=query("select * from menu where code='$_GET[code]'");
		$r=fetch($q);
		if($r['type']=="page")
			$filename="page.php";
		elseif($r['type']=="box1")
			$filename="box1.php";
		elseif($r['type']=="box2")
			$filename="box2.php";
		elseif($r['type']=="video")
			$filename="video.php";
		else
			$filename="error.php";
		DEFINE("SITE_TITLE",str_replace("'",'"',"Tin tức ".$r["name"]." - ".SITE_NAME),true);
}
else
{
	$filename="error.php";
}
$sel=query("select * from quangcao where position=5 and is_active=1 order by sort asc");
$i=0;
while($fsel=fetch($sel))
{
$fsel['count']=$i;
	$decode=json_decode($fsel[content],true);
	$fsel[img]=$decode[0];
	$fsel[url]=$decode[1];
	$qc[]=$fsel;
	$i++;
}
$smarty->assign("quangcao",$qc);
$smarty->assign("leftfile",MODULES."/$filename");
$smarty->display("main.htm");
?>